#include<bits/stdc++.h>
#define int long long 
#define mod 1000000007 
using namespace std;
int a[10005],res[10005],c[10005],n,tot,vis[10005],ans,maxn;
void dfs(int x) {
	if(x > n) {
//		for(int i=1;i<=n;i++)
//			cout<<res[i]<<" ";cout<<"\n";
		int res1 = n;
		for(int i=1;i<n;i++) {
			for(int j=i+1;j<=n;j++) {
				int flag = 0;
				for(int k=i;k<=(j-i+1)/2+i-1;k++) {
					if(res[k] != res[j-k+i]) {
						flag = 1;
						break;
					}
				} if(!flag)res1 ++;
			}
		} if(res1 > maxn)maxn = res1,ans = 0;
		if(res1 == maxn)ans ++;
//		cout<<res1<<"\n";
		return void();
	} for(int i=1;i<=tot;i++)
		if(vis[i] < a[c[i]])
			vis[i] ++,res[x] = i,dfs(x+1),vis[i] --;
}
signed main()
{
	freopen("palindrome.in","r",stdin);
	freopen("palindrome.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++) {
		int x; cin>>x;
		a[x] ++;
		if(a[x] == 1)
			c[++tot] = x;
	} 
	dfs(1);
	cout<<maxn<<" "<<ans;
	return 0;
}
